let app = getApp()
Component({
    properties: {
 
      },
      data:{
        carCount: 0
      },
    lifetimes: {
        attached: function () {
            this.setData({
              init:wx.getStorageSync('float')
            })
            var that=this
            wx.request({
              url: app.globalData.siteroot,
              data: {
                do:'Goods_cartList',
                user_id:wx.getStorageSync('user_id')
              },
              success: function(res) {
                  var carCount=0;
                  for(var i=0;i<res.data.data.length;i++)
                  {
                    carCount=carCount+res.data.data[i].num
                  }
                  that.setData({
                    carCount:carCount
                  })
              }
            })
       }
      },
    methods: {
      back_home:function(){
        wx.navigateTo({
          url: '/yb_shopv2/entry/video-market/index'
        })
      },
      car:function(){
        wx.navigateTo({
          url: '/yb_shopv2/native/all/index?type=shop_car'
        })
      },
      tel:function(){
        var phoneNumber=this.data.init.tel.value
        wx.makePhoneCall({
          phoneNumber:phoneNumber,
          success:function(){
          },
          fail:function(){
            console.log('拨打失败')
          }
        })
      },
      service:function(){
        wx.navigateTo({
          url: '/yb_shopv2/native/all/index?type=chat'
        })
      }
    }
});
